package com.mccken.springframework.core.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2022-11-30 15:43
 **/
public class FileSystemResource implements Resource{
	private final File file;
	
	private final String path;
	
	public FileSystemResource(String path) {
		this.file = new File(path);
		this.path = path;
	}
	public FileSystemResource(File file) {
		this.file = file;
		this.path = file.getPath();
	}
	
	public final String getPath() {
		return this.path;
	}
	
	@Override
	public InputStream getInputStream() throws IOException {
		return new FileInputStream(file);
	}
}
